/*
 * @Author: xiaosihan 
 * @Date: 2021-12-22 11:35:48 
 * @Last Modified by: xiaosihan
 * @Last Modified time: 2021-12-22 15:33:27
 */


/*
 * @Author: xiaosihan 
 * @Date: 2021-03-28 02:25:11 
 * @Last Modified by: xiaosihan
 * @Last Modified time: 2021-07-10 20:13:33
 */

import { round } from "lodash";
import { configure, observable } from "mobx";
import { Current } from "./type";

// 允许直接修改状态
configure({ enforceActions: "never" });

// 全局状态
const homeStore = observable({

    // "home" 主页
    // "fundDetection" 基金运行监测
    current: "home" as Current,

    homeRenderloaded: false, // 主页加载完成

    x: 0,
    y: 0,
    z: 0,

    setPosition(x: number, y: number, z: number) {
        this.x = round(x, 0);
        this.y = round(y, 0);
        this.z = round(z, 0);
    },

    getPosition() {
        return { x: this.x, y: this.y, z: this.z }
    }
});

window.homeStore = homeStore;

export default homeStore;